package thinking.a15.b2;

/**
 * 泛型类，告诉编译器想使用什么类型，编译器处理细节
 * @author yuan
 */
public class Holder3<T> {
    private T a;

    public Holder3(T a) {
        this.a = a;
    }

    public T get() {
        return a;
    }

    public void set(T a) {
        this.a = a;
    }

    public static void main(String[] args) {
        Holder3<Automobile> h3 = new Holder3<>(new Automobile());
        Automobile a = h3.get();
        // h3.set("Not an Mobile"); 无法转换 编译报错
        // h3.set(1); 无法转换，编译报错
    }
}
